<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$router->get('/', function () use ($router) {
    return "api";//$router->app->version();
});

//防止浏览器访问favicon.ico出现404
$router->get('/favicon.ico', function () {});

$router->addRoute(['OPTIONS'], '{url:.*}', function () {
    header('HTTP/1.1 200 OK');
    header("Content-Type:application/json;charset=utf-8");
    header('Access-Control-Allow-Origin:*'); // *代表允许任何网址请求
    header('Access-Control-Allow-Headers: Origin, Authorization, H5-User-Agent, Requested-Token, X-Requested-With, Content-Type, Accept, WG-App-Version, WG-Device-Id, WG-Network-Type, WG-Vendor, WG-OS-Type, WG-OS-Version, WG-Device-Model, WG-CPU, WG-Sid, WG-App-Id, WG-Token, XMLHttpRequest, access-control-allow-origin');
    header('Access-Control-Allow-Credentials: true'); // 设置是否允许发送 cookies
    header('Access-Control-Allow-Methods:POST,GET,OPTIONS,DELETE'); // 允许请求的类型
    \App\Http\Model\OutJson::outJsonResult(\App\Http\Model\Hint::SUCCESS);
});

$router->post('user/rongCallback', ['uses' => 'UserController@rongCallback']);


$router->group(['prefix' => 'inner'], function () use ($router) {

    // 动态
    $router->group(['prefix' => 'trends'], function () use ($router) {
        $router->get('set_type', ['uses' => 'TrendsController@setTrendsType']);
        $router->get('audit_switch', ['uses' => 'TrendsController@trendsAuditSwitch']);
        $router->get('audit', ['uses' => 'TrendsController@trendsAudit']);
    });

    // 动态话题
    $router->group(['prefix' => 'trends_topic'], function () use ($router) {
        $router->post('upsert', ['uses' => 'TrendsTopicController@updateOrInsertTrendsTopic']);
        $router->get('remove', ['uses' => 'TrendsTopicController@removeTrendsTopic']);
    });

    //动态
    $router->group(['prefix' => 'trends'], function () use ($router) {
        // 动态更新
        $router->get('update', ['uses' => 'TrendsController@trendsUpdate']);
        //动态评论删除
        $router->get('comment/del', ['uses' => 'TrendsController@commentDel']);
        //动态推荐广告位
        $router->post('curdAd', ['uses' => 'TrendsController@curdTrendsAd']);
        $router->post('delAd', ['uses' => 'TrendsController@delTrendsAd']);

    });


    //系统配置
    $router->group(['prefix' => 'system'], function () use ($router) {
        // 后台调用
        $router->post('config/create', ['uses' => 'SystemController@configCreate']);
        $router->post('config/update', ['uses' => 'SystemController@configUpdate']);
        $router->get('config/remove', ['uses' => 'SystemController@configRemove']);
        $router->post('version/create', ['uses' => 'SystemController@versionCreate']);
        $router->post('version/update', ['uses' => 'SystemController@versionUpdate']);
        $router->get('version/remove', ['uses' => 'SystemController@versionRemove']);
        $router->get('put_file_url', ['uses' => 'SystemController@get_put_file_url_manage']);
        $router->get('test_adjust', ['uses' => 'SystemController@getAdjust']);

        $router->get('get_config', ['uses' => 'SystemController@getConfig']);
    });

    // 公会
    $router->group(['prefix' => 'union'], function () use ($router) {
        $router->post('createUnion', ['uses' => 'UnionController@cmsCreatedUnion']);
        $router->post('updateUnion', ['uses' => 'UnionController@cmsUpdateUnion']);
        $router->post('addUnionRoom', ['uses' => 'UnionController@cmsAddUnionRoom']);
        $router->post('roomJoinUnion', ['uses' => 'UnionController@roomJoinUnion']);
        $router->post('cmsDissolveUnion', ['uses' => 'UnionController@cmsDissolveUnion']);
        $router->get('cmsKickUnionUser', ['uses' => 'UnionController@cmsKickUnionUser']);
        //cms提供获取公会财富等级与活跃等级
        $router->get('getGrade', ['uses' => 'UnionController@cmsGetGrade']);
    });

    $router->group(['prefix' => 'room'], function () use ($router) {
        //英杰提供
        $router->get('update', ['uses' => 'RoomController@roomUpdate']);
        $router->get('cbd/create', ['uses' => 'RoomController@createRoomByCBD']);
        $router->post('cbd/update', ['uses' => 'RoomController@updateRoomByCBD']);
        $router->post('set_name', ['uses' => 'RoomController@set_name']);
        $router->post('set_notice', ['uses' => 'RoomController@set_notice']);
        $router->post('set_desc', ['uses' => 'RoomController@set_desc']);
        $router->post('set_cert', ['uses' => 'RoomController@set_cert']);
        $router->post('set_image', ['uses' => 'RoomController@set_image']);
        $router->post('set_room_allow_type', ['uses' => 'RoomUserController@setRoomAllowType']);
        $router->post('get_room_allow_type', ['uses' => 'RoomUserController@getRoomAllowType']);
        $router->get('voice/check/get/config', ['uses' => 'RoomVoiceCheckController@getConfig']);
        $router->post('voice/check/set/config', ['uses' => 'RoomVoiceCheckController@setConfig']);
        $router->post('voice/check/log/edit', ['uses' => 'RoomVoiceCheckController@eidtVoiceCheckLogStatus']);

        $router->get('tag/create', ['uses' => 'RoomController@roomTagCreate']);
        $router->get('tag/update', ['uses' => 'RoomController@roomTagUpdate']);

        //cms接口
        $router->get('all/kill', ['uses' => 'RoomController@killAllRoom']);
        $router->post('kill', ['uses' => 'RoomController@killRoom']);

        //房间推荐标签
        $router->post('label/del', ['uses' => 'RoomController@labelDel']);  //标签删除
        $router->post('label/create', ['uses' => 'RoomController@labelCreate']); //新增商品标签
        $router->post('label/edit', ['uses' => 'RoomController@labelEdit']); //编辑商品标签
        $router->post('label/insertOrUpdate', ['uses' => 'RoomController@insertOrUpdateLabel']);
        $router->post('label/delRoomLabel', ['uses' => 'RoomController@delRoomLabel']);
        //定时设置/取消设置 房间标签
        $router->get('label/timingHandle', ['uses' => 'RoomController@timingHandleLabel']);// V1.0

        // 后台调用
        $router->get('reco/create', ['uses' => 'RoomController@roomRecoCreate']);
        $router->get('reco/get', ['uses' => 'RoomController@getRoomRecommend']);
        $router->get('reco/update', ['uses' => 'RoomController@roomRecoUpdate']);
        $router->get('reco/remove', ['uses' => 'RoomController@roomRecoRemove']);
        $router->get('recommend/replace', ['uses' => 'RoomController@roomRecommendReplace']);

        $router->get('report/update', ['uses' => 'RoomController@reportUpdate']);

        $router->get('image/examine', ['uses' => 'RoomController@roomImageExamine']);

        // 音频检测
        $router->post('voice/check/set/config', ['uses' => 'RoomVoiceCheckController@setConfig']);
        $router->get('voice/check/start/loop', ['uses' => 'RoomVoiceCheckController@loopStart']);//音频检测 V1.0
        $router->get('voice/check/stop/loop', ['uses' => 'RoomVoiceCheckController@loopStop']);//音频检测 V1.0
        $router->post('voice/check/callback', ['uses' => 'RoomVoiceCheckController@callBack']);//音频检测 V1.0
        $router->get('voice/check/get/config', ['uses' => 'RoomVoiceCheckController@getConfig']);
        $router->get('voice/check/high/get', ['uses' => 'RoomVoiceCheckController@getHighRooms']);
        $router->get('voice/check/high/add', ['uses' => 'RoomVoiceCheckController@addHighRoom']);
        $router->get('voice/check/high/del', ['uses' => 'RoomVoiceCheckController@delHighRoom']);

        //房间类型
        $router->post('/type/upsert', ['uses' => 'RoomController@updateOrInsertRoomType']);
        $router->post('/type/del', ['uses' => 'RoomController@delRoomType']);

        $router->post('set_car_status', ['uses' => 'RoomController@setCarStatus']);
        $router->post('role/cancel', ['uses' => 'RoomController@cmsCancelRole']);
        $router->post('background/dynamic', ['uses' => 'RoomController@setDynamicBackground']);

    });

    //用户相关
    $router->group(['prefix' => 'user'], function () use ($router) {
        //屏蔽用户，屏蔽设备
        $router->post('forbid_user', ['uses' => 'UserController@set_forbid_user']);
        $router->post('forbid_device', ['uses' => 'UserController@set_forbid_device']);
        $router->get('forbid_device', ['uses' => 'UserController@get_forbid_device']);
        $router->post('forbid_ip', ['uses' => 'UserController@set_forbid_ip']);
        $router->post('unforbid_ip', ['uses' => 'UserController@set_unforbid_ip']);
        $router->post('forbid_ip_list', ['uses' => 'UserController@forbid_ip_list']);
        $router->post('remove_ip_forbid', ['uses' => 'UserController@remove_ip_forbid']);
        $router->post('deny_ip_list', ['uses' => 'UserController@deny_ip_list']);
        $router->get('resetDevice', ['uses' => 'UserController@resetDevice']);//重置用户设备
        $router->post('remove_forbid_user', ['uses' => 'UserController@remove_forbid_user']);
        $router->get('forbid_list', ['uses' => 'UserController@get_forbid_list']);
        $router->get('forbid_status', ['uses' => 'UserController@get_user_forbid_status']);

        // cms 调用
        // $router->post('clear_cache', ['uses' => 'UserController@clear_cache']);

        // 后台调用
        $router->post('block/create', ['uses' => 'UserController@blockCreate']);
        $router->post('block/update', ['uses' => 'UserController@blockUpdate']);
        $router->get('block/remove', ['uses' => 'UserController@blockRemove']);
        $router->get('edit/user_info', ['uses' => 'UserController@editUserInfo']);
        $router->post('edit_user', ['uses' => 'UserController@edit_user']);
        $router->post('set_liang', ['uses' => 'UserController@setLiang']);
        $router->post('set_super', ['uses' => 'UserController@setSuper']);
        $router->post('set_official', ['uses' => 'UserController@setOfficial']);
        $router->post('set_waiter', ['uses' => 'UserController@setWaiter']);
        $router->post('set_v', ['uses' => 'UserController@setV']);
        $router->post('set_uid', ['uses' => 'UserController@setUid']);
        $router->post('set_active_certify', ['uses' => 'UserController@cmsSetCertify']);
        $router->post('create_user_verity', ['uses' => 'UserVerifyController@createUserVerify']);
        $router->post('set_abnormal', ['uses' => 'UserController@setAbnormal']);
        $router->post('curd_recharge_limit', ['uses' => 'UserController@curdRechargeLimit']);
        $router->get('del_recharge_limit', ['uses' => 'UserController@delRechargeLimit']);
        $router->post('changeBindPhone', ['uses' => 'UserController@changeBindPhone']);
        $router->post('create_tags', ['uses' => 'UserController@createUserTag']);
        $router->post('update_tags', ['uses' => 'UserController@updateUserTag']);
        $router->post('clear_verify', ['uses' => 'UserVerifyController@clearVerify']);
        // 个性标签分类
        $router->post('create_tags_cat', ['uses' => 'UserController@createUserTagsCat']);
        $router->post('update_tags_cat', ['uses' => 'UserController@updateUserTagsCat']);
        $router->post('del_tags_cat', ['uses' => 'UserController@delUserTagsCat']);
        //后台简易注销用户
        $router->post('simpleAccountCancel', ['uses' => 'UserController@simpleAccountCancel']);

    });

    //friends
    $router->group(['prefix' => 'friends'], function () use ($router) {
        // 举报用戶更新
        $router->get('report/update', ['uses' => 'FriendsController@reportUpdate']);
    });

    //飘萍
    $router->group(['prefix' => 'full'], function () use ($router) {
        $router->post('add', ['uses' => 'FullScreenController@add']);
        $router->post('edit', ['uses' => 'FullScreenController@edit']);
        $router->post('del', ['uses' => 'FullScreenController@del']);
        $router->get('list', ['uses' => 'FullScreenController@fullList']);
        $router->get('get_full_screen', ['uses' => 'FullScreenController@getFullScreen']);
        $router->get('get_full_page', ['uses' => 'FullScreenController@getFullPage']);
    });

    //消息相关
    $router->group(['prefix' => 'msg'], function () use ($router) {
        $router->post('text', ['uses' => 'MsgController@sys_text_msg']);
        $router->get('keep_alive_chat', ['uses' => 'MsgController@keep_alive_chat_cron']);
        $router->post('all_warning_msg', ['uses' => 'MsgController@allWarningMsg']);
        $router->post('warning_msg', ['uses' => 'MsgController@warningMsg']);
        $router->post('simple_full_service_msg', ['uses' => 'MsgController@simpleFullServiceMsgNotify']);
        $router->post('send_full_screen', ['uses' => 'MsgController@sendFullScreen']);
    });

    //商品
    $router->group(['prefix' => 'mall'], function () use ($router) {
        // 赠送用户商品
        $router->post('goods/give_user', ['uses' => 'MallController@giveUserGoods']);

        // 后台调用
        $router->post('create', ['uses' => 'MallController@goodsCreate']);
        $router->post('update', ['uses' => 'MallController@goodsUpdate']);
        $router->get('remove', ['uses' => 'MallController@goodsRemove']);

        $router->post('sku_create', ['uses' => 'MallController@goodsSkuCreate']);
        $router->post('sku_update', ['uses' => 'MallController@goodsSkuUpdate']);
        $router->get('sku_remove', ['uses' => 'MallController@goodsSkuRemove']);
        $router->get('sku_set_default', ['uses' => 'MallController@goodsSkuSetDefault']);
        $router->post('back_send_goods', ['uses' => 'MallController@back_send_goods']);

        //过期作废
        $router->post('void_user_goods', ['uses' => 'MallController@onVoidUserGoods']);

        $router->post('label/create', ['uses' => 'MallController@labelCreate']); //新增商品标签
        $router->post('label/del', ['uses' => 'MallController@labelDel']); //删除商品标签
        $router->post('label/edit', ['uses' => 'MallController@labelEdit']); //编辑商品标签
        $router->post('union/create', ['uses' => 'MallController@createMallUnionGoods']);
        $router->post('union/edit', ['uses' => 'MallController@updateMallUnionGoods']);


        // 商品等级借口
        $router->get('goods_level/list', ['uses' => 'MallController@goodsLevelList']);


    });


    $router->group(['prefix' => 'finance'], function () use ($router) {
        //cms接口
        $router->post('back/pay', ['uses' => 'FinanceController@set_diamond_balance']);
        $router->post('back/kk/minus', ['uses' => 'FinanceController@minusKkValue']);
        $router->post('back/kk/inc', ['uses' => 'FinanceController@incKkValue']);
        $router->post('back/diamond/inc', ['uses' => 'FinanceController@incDiamondValue']);
        $router->post('pay/agent', ['uses' => 'FinancePayController@agent']);
        $router->get('withdraw/dismiss', ['uses' => 'FinanceWithdrawController@dismiss']);
        $router->post('withdraw/updateOrderStatus', ['uses' => 'FinanceWithdrawController@updateOrderStatus']);
        $router->post('withdraw/update_pay_type', ['uses' => 'FinanceWithdrawController@updatePayType']);
        $router->post('withdraw/pay/bls_order', ['uses' => 'FinanceWithdrawController@payBlsOrder']);//后台审核同意贝灵斯提现操作

        // 后台调用
        $router->get('wallet/update', ['uses' => 'FinanceController@walletUpdate']);
        $router->post('withdraw/exception_user', ['uses' => 'FinanceWithdrawController@withdrawExceptionUser']);

        // 提现规则限制
        $router->post('withdraw/cash_number', ['uses' => 'FinanceWithdrawController@withdrawCashNumber']);
        $router->post('withdraw/bank_number', ['uses' => 'FinanceWithdrawController@withdrawBankNumber']);
        $router->post('withdraw/week', ['uses' => 'FinanceWithdrawController@withdrawWeek']);

    });

    $router->get('account/loop', ['uses' => 'UserController@loopAccountCancel']);

    $router->group(['prefix' => 'counter'], function () use ($router) {
        $router->post('upsert', ['uses' => 'CounterController@updateOrInsertCounter']);
        $router->get('remove', ['uses' => 'CounterController@removeCounter']);

        $router->post('cate/upsert', ['uses' => 'CounterController@updateOrInsertCounterCate']);
        $router->get('cate/remove', ['uses' => 'CounterController@removeCounterCate']);
        $router->post('new_play', ['uses' => 'CounterController@createOrUpdateCounterNewPlay']);
    });

    $router->group(['prefix' => 'content'], function () use ($router) {
        $router->post('check/audit', ['uses' => 'ContentCheckController@checkAudit']);
        // $router->get('image/loop', ['uses' => 'ContentCheckController@loopFilterImage']);//循环处理图片检测 V1.0
    });

    $router->group(['prefix' => 'music'], function () use ($router) {
        $router->post('audit', ['uses' => 'MusicController@audit']);
        $router->post('delete', ['uses' => 'MusicController@deleteMusic']);
    });

    $router->group(['prefix' => 'room_live'], function () use ($router) {
        $router->post('store', ['uses' => 'RoomController@createRoomLivePlan']);
        $router->get('remove', ['uses' => 'RoomController@removeRoomLivePlan']);
    });

    //推送客户端上报点击
    $router->group(['prefix' => 'push'], function () use ($router) {
        $router->get('getlog', ['uses' => 'SystemController@getPushClickLog']);
        $router->get('dellog', ['uses' => 'SystemController@delPushClickLog']);
        $router->get('room/info', ['uses' => 'RoomController@pushInfo']);
    });

    //底部资源
    $router->group(['prefix' => 'nav'], function () use ($router) {
        $router->post('setNavMenu', ['uses' => 'SystemController@setNavMenu']);
        $router->post('delNavMenu', ['uses' => 'SystemController@delNavMenu']);
    });

    //房间白名单
    $router->group(['prefix' => 'testuser'] , function () use ($router) {
        $router->get('get', ['uses' => 'UserController@getTestUser']);
        $router->post('add', ['uses' => 'UserController@addTestUser']);
        $router->post('del', ['uses' => 'UserController@delTestUser']);
    });


    //房间动态封面
    $router->post('room/dynamic/addorupdate','RoomController@setDynamic');
    $router->post('room/dynamic/del','RoomController@delDynamic');

    // 后台操作房间积分变更
    $router->group(['prefix' => 'roomScore'], function () use ($router) {
        //设置房间信誉值
        $router->post('setRoomReputation', ['uses' => 'RoomScoreController@setRoomReputation']);
        //信誉值更新定时器。房间在一定时间内没有违规，会自动涨积分
        $router->get('roomReputationTimer', ['uses' => 'RoomScoreController@roomReputationTimer']);// V1.0
    });

    //房间话题
    $router->group(['prefix' => 'roomVoteTopic'], function () use ($router) {
        $router->post('edit', ['uses' => 'RoomVoteController@editTopic']); //新增/编辑话题
        $router->post('del', ['uses' => 'RoomVoteController@deleteTopic']); //删除话题
    });


});
